package com.banyuan.ClassRelated.practice.demo2;

public class Student {
    private String name;
    private int money;
//    private int moneyB;
//    private int moneyL;

    public Student() {
    }

    public Student(String name, int money) {
        this.name = name;
        this.money = money;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setMoney(int money) {
        this.money = money;
    }

   /* public void setMoneyB(int moneyB) {
        this.moneyB = moneyB;
    }
*/
    /*public void setMoneyL(int moneyL) {
        this.moneyL = moneyL;
    }*/

    public int getMoney() {
        return this.money;
    }

    public String getName() {
        return this.name;
    }

   /* public int getMoneyB() {
        return moneyB;
    }*/

    /*public int getMoneyL() {
        return moneyL;
    }*/

    public void show() {
        System.out.println(this.name + "有" + this.getMoney() + "元钱");
    }

    public void borrow(Student s1, int money) {
        System.out.println(this.name + "向" + s1.getName() + "借" + money + "元钱");
        Student s2 = this;
        s1.lend(s2, money);
//        this.setMoneyB(money);
//        s1.setMoneyL(money);
    }

    public void lend(Student s1, int money) {
        this.money -= money;
        s1.setMoney(s1.getMoney() + money);
        System.out.println(this.name + "同意了借钱");
        System.out.println(this.getName() + "借给了" + s1.getName() + money + "元钱");
        System.out.println(this.name + "现在有" + this.money + "元钱");
        System.out.println(s1.getName() + "现在有" + s1.getMoney() + "元钱");
    }
}
